package blazingbubble.game.command.net;

import blazingbubble.game.command.GameCommandFactory;
import blazingbubble.game.command.ReadyToPlayCommand;
import blazingbubble.game.command.CannonRotateStartCommand;
import blazingbubble.game.command.CannonRotateEndCommand;
import spark.network.Sender;
import spark.network.NetworkConnection;

public class NetGameCommandFactory extends GameCommandFactory {
	private NetJoinGameCommand joinGame;
	private NetStartGameCommand startGame;
	private NetReadyToPlayCommand readyToPlay;
	private NetCannonFireCommand fire;
	private NetCannonRotateStartCommand cannonRotateStart;
	private NetCannonRotateEndCommand cannonRotateEnd;
	private NetJoinTeamCommand joinTeam;

	public NetGameCommandFactory() {
		joinGame = new NetJoinGameCommand();
		joinTeam = new NetJoinTeamCommand();
		readyToPlay = new NetReadyToPlayCommand();
		fire = new NetCannonFireCommand();
		cannonRotateStart = new NetCannonRotateStartCommand();
		cannonRotateEnd = new NetCannonRotateEndCommand();
		startGame = new NetStartGameCommand();
	}

	public void startup(Sender sender, NetworkConnection serverConnection, int queryPort) {
		joinGame.startupNetworkingAbility(sender, serverConnection);
		joinGame.setResponsePort(queryPort);
		joinTeam.startupNetworkingAbility(sender, serverConnection);
		readyToPlay.startupNetworkingAbility(sender, serverConnection);
		fire.startupNetworkingAbility(sender, serverConnection);
		cannonRotateStart.startupNetworkingAbility(sender, serverConnection);
		cannonRotateEnd.startupNetworkingAbility(sender, serverConnection);
		startGame.startupNetworkingAbility(sender, serverConnection);
	}

	public void startupHostActions(long hostIdentification) {
		startGame.setHostIdentification(hostIdentification);
	}

	@Override
	public NetJoinGameCommand getJoinGame() {
		return joinGame;
	}


	@Override
	public NetJoinTeamCommand getJoinTeam() {
		return joinTeam;
	}

	@Override
	public NetStartGameCommand getStartGame() {
		return startGame;
	}

	@Override
	public ReadyToPlayCommand getReadyToPlay() {
		return readyToPlay;
	}

	@Override
	public NetCannonFireCommand getFire() {
		return fire;
	}

	@Override
	public CannonRotateStartCommand getCannonRotateStart() {
		return cannonRotateStart;
	}

	@Override
	public CannonRotateEndCommand getCannonRotateEnd() {
		return cannonRotateEnd;
	}
}
